package org.example.chat.controller;

import cn.dev33.satoken.stp.StpUtil;
import org.example.chat.service.IChatFriendService;
import org.example.chat.vo.FriendVO;
import org.example.common.config.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/chat/friend")
public class ChatFriendController {
    @Autowired
    private IChatFriendService chatFriendService;

    //获取好友列表
    @RequestMapping("/list")
    public Result getFriend() {
        long userId = StpUtil.getLoginIdAsLong();
        List<FriendVO> friendList = chatFriendService.getFriendList(userId);
        return Result.ok(friendList);
    }
}
